#ifndef ATTENDANCEQUERY_H
#define ATTENDANCEQUERY_H

#include <QDate>
#include <QObject>
#include <QSqlDatabase>

struct AttendanceRecord {
    int att_id;
    QString emp_name;
    QString dept_name;
    QDate check_date;
    QDateTime clock_in;
    QDateTime clock_out;
    QString status;
};

class AttendanceQuery : public QObject
{
    Q_OBJECT
public:
    explicit AttendanceQuery(QSqlDatabase db, QObject *parent = nullptr);

    QSqlQuery setQuery(
        const QString& timeRange,   // ALL/月/周/日
        const QString& dept,        // ALL/部门名
        const QString& status,      // ALL/正常/异常
        const QDate& date           // 指定日期（可选）
        );

    QSqlQuery queryDeptAttendance(const QString &deptName, const QString& granularity, const QDate& date);
signals:

private:
    QSqlDatabase m_db;
};

#endif // ATTENDANCEQUERY_H
